package com.lanou.sinasports.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.lanou.sinasports.fragment.EventsFragment;

import com.lanou.sinasports.fragment.MatchHotFragment;
import com.lanou.sinasports.fragment.MyFragment;


import java.util.ArrayList;
import java.util.List;

/**
 * Created by dllo on 16/1/7.
 */
public class MatchAdapter extends FragmentPagerAdapter {
    private List<Fragment> fragments;
    private String titles[]={"赛事","热门","我的"};

    public MatchAdapter(FragmentManager fm) {
        super(fm);
        fragments=new ArrayList<>();
        EventsFragment eventsFragment=new EventsFragment();
        MatchHotFragment matchHotFragment=new MatchHotFragment();
        MyFragment myFragment=new MyFragment();
        fragments.add(eventsFragment);
        fragments.add(matchHotFragment);
        fragments.add(myFragment);
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {

        return fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
